﻿using System;
using System.ComponentModel;

namespace DimensionsHelper.Common.Contracts;

public enum ReportMessageType
{
    Info,
    Warn,
    Error
}


/// <summary>
///     报告级别
/// </summary>
public enum ReportLevel
{
    /// <summary>
    ///     只报告简略消息
    /// </summary>
    [Description("简略")]
    Brief,

    /// <summary>
    ///     报告所有消息
    /// </summary>
    [Description("详细")]
    Detail
}


/// <summary>
///     报告消息时使用的回调参数。
/// </summary>
public class ReportEventArgs(
    ReportMessageType type,
    string message,
    double progress = double.NaN,
    string section = "",
    ReportLevel level = ReportLevel.Brief,
    string localPath = "")
    : EventArgs
{
    /// <summary>
    ///     消息类型，分为 信息、警告、错误 三种。
    /// </summary>
    public ReportMessageType Type { get; } = type;

    /// <summary>
    ///     消息文本
    /// </summary>
    public string Message { get; } = message;

    /// <summary>
    ///     百分比数值，应当是 0 - 100 之间的数值。
    /// </summary>
    public double Progress { get; } = progress;

    /// <summary>
    ///     报告所属项目名
    /// </summary>
    public string Section { get; } = section;

    /// <summary>
    ///     报告级别
    /// </summary>
    public ReportLevel Level { get; } = level;

    /// <summary>
    ///     本地文件路径
    /// </summary>
    public string LocalPath { get; } = localPath;
}